package com.dankegongyu.shell.js.common;

import android.app.Activity;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dankegongyu.shell.js.R;


/**
 * Created by Admin on 2017/12/26.
 */
public class ShellCell extends RelativeLayout implements IRecycleViewListener {

    private TextView tvTitle;
    private View vLine;

    private Activity mActivity;

    public ShellCell(Context context) {
        super(context);
    }

    public ShellCell(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ShellCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        if (!isInEditMode()) {
            mActivity = (Activity) getContext();
        }

        tvTitle = findViewById(R.id.tv_title);
        vLine = findViewById(R.id.v_line);

    }


    @Override
    public void setData(Object obj, int position, RecyclerView.Adapter adapter) {

        ShellData data = (ShellData) obj;
        tvTitle.setText(data.getName());
        vLine.setVisibility(View.VISIBLE);

    }


}
